<template>
  <div>
    <div style="display: flex; align-items: center;">
      <img src="../../../../static/线条 1@1x.png" alt="">
      <span style="margin-left: 10px; font-size: 30px; color: #415058; font-weight: bold;">我的课程拓扑图</span>
    </div>
    <router-link to="course-details">
      <div class="bktopo-container">
      <div class="bktopo_demo" id="bktopo_demo2">
        <div class="none node" id="node-templates" data-container="body" data-placement="top" data-html="true" 
          data-trigger="hover">
          <div class="node-container"><span class="node-text"></span></div>
        </div>
        <div class="bktopo_box" style="height:300px;"></div>
      </div>
    </div>
    </router-link>
  </div>

  <div style="margin-top: 10px;">
    <div style="display: flex; align-items: center;">
      <img src="../../../../static/线条 1@1x.png" alt="">
      <span style="margin-left: 10px; font-size: 30px; color: #415058; font-weight: bold;">查询专业课程拓扑图</span>
    </div>
    <div style="width: 100%;">    
      <selects></selects>
    </div>
    <div class="bktopo-container">
      <div class="bktopo_demo" id="bktopo_demo2">
        <div class="none node" id="node-templates" data-container="body" data-placement="top" data-html="true" style="" data-trigger="hover">
          <div class="node-container"><span class="node-text"></span></div>
        </div>
        <div class="bktopo_box" style="height:300px;"></div>
      </div>
    </div>
  </div>
</template>

<script>
import selects from "../../../components/selects.vue";
export default {
  components:{
    selects
  },
  data() {
      return {
        data: {
          "nodes": [
            {
              "id": "demo1_node1", "x": 100, "y": 50, "height": 30,
              "width": 80, "text": "C语言", "className": "node success"
            },
            {
              "id": "demo2_node1", "x": 250, "y": 50, "height": 30,
              "width": 80, "text": "数据结构", "className": "node success"
            },
            {
              "id": "demo2_node2", "x": 250, "y": 150, "height": 30,
              "width": 80, "text": "离散数学", "className": "node success"
            },
            {
              "id": "demo2_node3", "x": 250, "y": 250, "height": 30,
              "width": 80, "text": "Linux", "className": "node warning"
            },
            {
              "id": "demo3_node1", "x": 400, "y": 50, "height": 30,
              "width": 80, "text": "C++", "className": "node danger"
            },
            {
              "id": "demo3_node2", "x": 400, "y": 150, "height": 30,
              "width": 80, "text": "数据库原理", "className": "node success"
            },
            {
              "id": "demo3_node3", "x": 400, "y": 250, "height": 30,
              "width": 80, "text": "数字逻辑", "className": "node success"
            },
            {
              "id": "demo4_node1", "x": 550, "y": 50, "height": 30,
              "width": 80, "text": "桌面软件开发", "className": "node success"
            },
            {
              "id": "demo4_node21", "x": 500, "y": 150, "height": 30,
              "width": 80, "text": "桌面软件开发", "className": "node success"
            },
            {
              "id": "demo4_node22", "x": 600, "y": 150, "height": 30,
              "width": 80, "text": "桌面软件开发", "className": "node success"
            },
          ],
          "edges": [
            {
              "source": "demo1_node1", "sDirection": 'right',
              "target": "demo2_node1", "tDirection": 'left', "edgesType": "success"
            },
            {
              "source": "demo2_node1", "sDirection": 'right',
              "target": "demo3_node1", "tDirection": 'left', "edgesType": "danger"
            },
            {
              "source": "demo3_node1", "sDirection": 'right',
              "target": "demo4_node1", "tDirection": 'left', "edgesType": "success"
            },
            {
              "source": "demo2_node1", "sDirection": 'buttom',
              "target": "demo2_node2", "tDirection": 'top', "edgesType": "success"
            },
            {
              "source": "demo2_node2", "sDirection": 'buttom',
              "target": "demo2_node3", "tDirection": 'top', "edgesType": "warning"
            },
            {
              "source": "demo3_node1", "sDirection": 'buttom',
              "target": "demo3_node2", "tDirection": 'top', "edgesType": "success"
            },
            {
              "source": "demo3_node2", "sDirection": 'buttom',
              "target": "demo3_node3", "tDirection": 'top', "edgesType": "success"
            },
            {
              "source": "demo4_node1", "sDirection": 'buttom',
              "target": "demo4_node21", "tDirection": 'top', "edgesType": "success"
            },
            {
              "source": "demo4_node1", "sDirection": 'buttom',
              "target": "demo4_node22", "tDirection": 'top', "edgesType": "success"
            },
          ]
        }
      }
    },
  mounted() {
    this.init()
  },
  methods: {
    init() {
      $('#bktopo_demo2 .bktopo_box').bkTopology({
        data: this.data, //配置数据源
        lineType: [ //配置线条的类型
          { type: 'success', lineColor: '#46C37B' },
          { type: 'info', lineColor: '#4A9BFF', arrow: false },
          { type: 'warning', lineColor: '#f0a63a', arrow: false },
          { type: 'danger', lineColor: '#c94d3c', arrow: false },
          { type: 'default', lineColor: '#aaa', arrow: false }
        ],
      });
    },
    handleButtonClick() {
    this.$router.push({ name: 'course-details' });
    },
  }
}
</script>

<style scoped>

</style>
  
  